<?php
/**
 * WeConsult.php
 */
class Domain_WeNewConsult
{
    /**
     * 获取帖子列表
     * @desc wjp 2017-12-26
     * @throws PhalApi_Exception_InternalServerError
     */
    public function ConsultList($allParams)
    {
        $model = new Model_WeConsult;
        $info = $model->getConsultList($allParams);
        return $info;
    }

    /**
     * 获取帖子详情
     * @desc wjp 2017-12-26
     * @throws PhalApi_Exception_InternalServerError
     */
    public function ConsultDetail($allParams)
    {
        $model = new Model_WeConsult;
        if ($allParams['type'] == 1)
            $model->consultNumAdd($allParams['id']);
        $info = $model->getConsultDetail($allParams['id']);
        return $info;
    }

    /**
     * 获取帖子分类列表
     * @desc wjp 2017-12-26
     * @throws PhalApi_Exception_InternalServerError
     */
    public function ConsultClassList()
    {
        $model = new Model_WeConsultClass;

        if (isset(DI()->user['id'])) {

            $modelBind = new Model_WeConsultClassBind();
            $bindClass = $modelBind->getConsultClassBind(DI()->user['id']);
            if ($bindClass != null && $bindClass != []) {
                $info = $model->getConsultClassListById($bindClass['consultClassId']);
                return $info;
            }
        }
        $info = $model->getConsultClassList();
        return $info;
    }
}